using System;
using System.Collections.Generic;
using System.Text;
using NUnit.Framework;
using System.Windows.Forms;
using System.Drawing;
using OpenTK.Math;

namespace Dogfight2008.Tests
{
  [TestFixture]
  public class PressFireStateFixture
  {
    PressFireState s;

    [SetUp]
    public void Init()
    {
      s = new PressFireState();
    }

    [Test]
    public void Constr()
    {
    }

    [Test]
    public void PressingKeyChangesState() {
      DFState newState = s.KeyDown(Keys.Space);
      Assert.AreEqual(DFState.InGame, newState);
    }

    [Test]
    public void PressingEscIsIgnored()
    {
      DFState newState = s.KeyDown(Keys.Escape);
      Assert.AreEqual(DFState.PressFire, newState);
    }

    [Test]
    public void PassingTimeDoesNot()
    {
      DFState newState = s.Tick(1000000);
      Assert.AreEqual(DFState.PressFire, newState);
    }

    [Test]
    public void KeyUpMeansNothing()
    {
      DFState newState = s.KeyUp(Keys.A);
      Assert.AreEqual(DFState.PressFire, newState);
    }

    [Test]
    public void Render()
    {
      MockRenderer.TextAtDelegate expText = delegate(int callnumber, string text, Uniform x, Uniform y, Uniform height, Anchor anchor) {
        if (callnumber == 0)
        {
          Assert.AreEqual("[Press Fire]", text);
        }
      };
      MockRenderer.MeshAtDelegate expMesh = delegate(int cn, Mesh mesh, Matrix4 transform)
      {
        //Assert.AreEqual(Mesh.GreenPlane, mesh);
      };
      MockRenderer renderer = new MockRenderer(expText, expMesh);
      s.Render(renderer);
      Assert.IsTrue(renderer.TextAtCalled);
      //Assert.IsTrue(renderer.MeshAtCalled);
    }
  }
}
